<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
	<link rel="stylesheet" href="../static/lib/bootstrap/3.3.7/css/bootstrap.min.css" th:href="@{/lib/bootstrap/3.3.7/css/bootstrap.min.css}" />
	<style type="text/css">
	html, body, div {
		margin: 0;
		padding: 0;
	}
	.label_left {
		text-align: left !important;
	}
	</style>
	<script src="../static/lib/jquery/jquery-1.12.4.min.js" th:src="@{/lib/jquery/jquery-1.12.4.min.js}"></script>
	<script src="../static/lib/jquery/jquery-1.12.4.min.js" th:src="@{/lib/jquery/jquery.form.min.js}"></script>
	<script src="../static/lib/bootstrap/3.3.6/js/bootstrap.min.js" th:src="@{/lib/bootstrap/3.3.7/js/bootstrap.min.js}"></script>
	<script src="../static/lib/slimScroll/1.3.8/jquery.slimscroll.min.js" th:src="@{/lib/slimScroll/1.3.8/jquery.slimscroll.min.js}"></script>
	<script src="https://cdn.bootcss.com/pdfobject/2.0.201604172/pdfobject.min.js"></script>
	<!--[if lt IE 9]>
	<script src="../static/lib/html5shiv/3.7.3/html5shiv.min.js" th:src="@{/lib/html5shiv/3.7.3/html5shiv.min.js}"></script>
	<script src="../static/lib/respond/1.4.2/respond.min.js" th:src="@{/lib/respond/1.4.2/respond.min.js}"></script>
	<![endif]-->
</head>	
<body>
 <div style="width:50%; height: 600px; float: left" th:utext="${pageoffice}" id="po_div"></div> 
<!-- <div style="width:50%; height: 600px; float: left" id="po_div"></div> -->
<div style="width:50%; height: 600px; float: right; border: solid 1px; overflow: scroll;" id="pic_div">
	<th:block th:each="pic : ${files}">
		<div th:switch="${pic.type}" style="background-color: #ccc; font-weight: bold;">
			<span th:case="1" th:text="'合同：' + ${pic.oraName}"></span>
			<span th:case="2" th:text="'资料：' + ${pic.oraName}"></span>
			<span th:case="3" th:text="'补录资料：' + ${pic.oraName}"></span>
		</div>
		<th:block th:each="p : ${#strings.arraySplit(pic.filename, ';')}">
			<a th:href="@{/download/} + ${p}" target="_blank" th:if="${!(#strings.containsIgnoreCase(p,'png') || #strings.containsIgnoreCase(p,'jpg') || #strings.containsIgnoreCase(p,'jpeg') || #strings.containsIgnoreCase(p,'gif') || #strings.containsIgnoreCase(p,'bmp'))}" style="display: block; margin: 5px" th:text="${pic.oraName}">下载文件</a>
			<img th:src="@{/pic/} + ${p}" style="width: 100%" th:if="${#strings.containsIgnoreCase(p,'png') || #strings.containsIgnoreCase(p,'jpg') || #strings.containsIgnoreCase(p,'jpeg') || #strings.containsIgnoreCase(p,'gif') || #strings.containsIgnoreCase(p,'bmp')}"/>
		</th:block>
		
	</th:block>
</div>
<hr style="clear: both;" />
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default" style="margin-top: 10px">
<div class="panel-body">
<!-- 法务部复审S -->
<form id="audit_form" class="form-horizontal" th:action="@{/audit/second/submit}" method="post" enctype="multipart/form-data">
	<input type="hidden" name="id" th:value = "${ct.id}" />
	<div class="form-group">
		<label for="isHjb" class="col-sm-1 control-label">合同资料</label>
		<div class="col-sm-11" style="padding-top: 8px">
			<th:block th:each="file : ${files}">
				<a th:href="@{/download/} + ${file.filename}" target="_blank" th:text="${file.oraName}" th:if="${file.type == 2}" style="margin-right: 5px"></a>
			</th:block>
		</div>
	</div>
	<div class="form-group" th:if="${ct.fjtkAdd}">
		<label for="isHjb" class="col-sm-1 control-label">附加条款</label>
		<div class="col-sm-5">
			<p class="form-control-static" th:text="${ct.fjtkAdd}"></p>
		</div>
		<div class="col-sm-6">
			<p class="form-control-static" th:text="${ct.fjtkDel}"></p>
		</div>
	</div>
	<div class="form-group">
		<label for="isHjb" class="col-sm-1 control-label">审核</label>
		<div class="col-sm-4" th:if="${ct.curNode.id == 9}">
			<label class="radio-inline">
				<input type="radio" name="sp" id="sp1" value="1" checked>合同确认有效
			</label>
			<label class="radio-inline">
				<input type="radio" name="sp" id="sp2" value="0">合同格式不合格
			</label>
			<label class="radio-inline">
				<input type="radio" name="sp" id="sp3" value="2">合同涂抹修改，提交副总审核
			</label>
		</div>
		<div class="col-sm-4" th:if="${ct.curNode.id == 10}">
			<label class="radio-inline">
				<input type="radio" name="sp" id="sp1" value="1" checked>同意修改
			</label>
			<label class="radio-inline">
				<input type="radio" name="sp" id="sp2" value="0">合同修改无效
			</label>
			<label class="radio-inline">
				<input type="radio" name="sp" id="sp3" value="2">请示总经理
			</label>
		</div>
		<div class="col-sm-4" th:if="${ct.curNode.id == 11}">
			<label class="radio-inline">
				<input type="radio" name="sp" id="sp1" value="1" checked>同意修改
			</label>
			<label class="radio-inline">
				<input type="radio" name="sp" id="sp2" value="0">合同修改无效
			</label>
		</div>
		<div class="col-sm-4" th:if="${ct.curNode.id == 12}">
			<label class="radio-inline">
				<input type="radio" name="sp" id="sp1" value="1" checked>审批完成
			</label>
			<label class="radio-inline">
				<input type="radio" name="sp" id="sp1" value="0">补充合同资料
			</label>
		</div>
		<label for="sp_pic" class="col-sm-2 control-label" th:if="${ct.curNode.id == 12}">上传审批图片</label>
		<div class="col-sm-4" th:if="${ct.curNode.id == 12}">
			<input type="file" name="sp_pic" id="sp_pic" class="form-control">
		</div>
		<label class="col-sm-7 control-label label_left" style="display: none;" th:if="${ct.curNode.id == 10}" id="zjl_oper">
			下一步总经理审核：
			<select name="zjlOper" >
				<option th:each="oper : ${zjlOpers}" th:value="${oper.id}" th:text="${oper.name}"></option>
			</select>
		</label>
		<label class="col-sm-7 control-label label_left"  style="display: none;" th:if="${ct.curNode.id == 9}" id="fz_oper">
			下一步副总审核：
			<select name="fzOper" >
				<option th:each="oper : ${fzOpers}" th:value="${oper.id}" th:text="${oper.name}"></option>
			</select>
		</label>
		<label class="col-sm-7 control-label label_left" id="lcb_oper" th:if="${ct.curNode.id == 9 || ct.curNode.id == 10 || ct.curNode.id == 11}">下一步流程部审核：
			<select name="lcOper" >
				<option th:each="oper : ${lcOpers}" th:value="${oper.id}" th:text="${oper.name}"></option>
			</select>
		</label>
	</div>
	<div class="form-group" th:if="${syspyj}" >
		<div class="col-sm-12" >
			<p class="form-control-static" th:text="${syspyj}" style="margin-left: 50px"></p>
		</div>
	</div>
	<div class="form-group">
		<label for="isHjb" class="col-sm-1 control-label">审批意见</label>
		<div class="col-sm-10">
			<textarea class="form-control" rows="3" name="spyj"></textarea>
		</div>
		<div class="col-sm-1">
			<button type="button" class="btn btn-primary btn-block" onclick="form_submit()">提交审批</button>
		</div>
	</div>
</form>
<!-- 法务部复审E -->
</div>
</div>
</div></div></div>

<script type="text/javascript">

function do_layout() {
	var form_height = $("#audit_form").height();
	var h = $(window).height();
	var height = h - form_height - 100;
	if(height < 600) height = 600;
	$("#po_div").css('height', height + 'px');
	$("#pic_div").css('height', height + 'px');
}
$(function(){
	do_layout();
	$(window).resize(function(){
		do_layout();
	});
	$(":radio").click(function(){
		if($(this).val() == 1) {
			$("#lcb_oper").show();
			$("#fz_oper").hide();
			$("#zjl_oper").hide();
		} else if($(this).val() == 0){
			$("#lcb_oper").hide();
			$("#fz_oper").hide();
			$("#zjl_oper").hide();
		} else if($(this).val() == 2){
			$("#lcb_oper").hide();
			$("#fz_oper").show();
			$("#zjl_oper").show();
		}
	});
});

function form_submit() {
	if(!confirm("确认提交审批吗？")) return;
	$("#audit_form").ajaxSubmit(function(data){
		var ret = JSON.parse(data);
		if(ret.success) {
			var result = window.external.CallParentFunc("refresh('audit/second');");
			window.external.close();
		} else {
			alert(ret.message);
		}
	});
	/*
	$.post("[[@{/audit/second/submit}]]", $("#audit_form").serializeArray(), function(ret){
		if(ret.success) {
			var result = window.external.CallParentFunc("refresh('audit/second');");
			window.external.close();
		} else {
			alert(ret.message);
		}
	}, "json");
	*/
}

function fullScreen() {
    document.getElementById("page_office").FullScreen = !document.getElementById("page_office").FullScreen;
}

function office_toolbar() {
    document.getElementById("page_office").OfficeToolbars = !document.getElementById("page_office").OfficeToolbars;
}
function close(){
	window.external.close(); 
}
</script>
</body>
</html>
